package com.chagee.store.operation.common.exception;

import com.chagee.base.constant.CommonErrorCode;
import com.chagee.base.exception.BaseException;
import com.chagee.base.exception.BizExpCode;

/**
 * @author yhl
 * @version 1.0
 * @className BizException
 * @description 异常
 * @date 2023/12/19 17:01:45
 */
public class BizException extends BaseException {

	private BizException() {
		super();
	}

	/**
	 * 自定义异常-默认异常码
	 *
	 * @param errorMsg
	 */
	public BizException(String errorMsg) {
		super(CommonErrorCode.FAIL.getErrorCode(), errorMsg);
	}

	public BizException(String errorMsg, Throwable t) {
		super(CommonErrorCode.FAIL.getErrorCode(), errorMsg, t);
	}

	/**
	 * 自定义异常
	 *
	 * @param errorCode
	 * @param errorMsg
	 */
	public BizException(String errorCode, String errorMsg) {
		super(errorCode, errorMsg);
	}

	/**
	 * 自定义异常
	 *
	 * @param errorMsg
	 */
	public BizException(BizExpCode bizExpCode, String errorMsg) {
		super(bizExpCode.getErrorCode(), errorMsg);
	}

	public BizException(String errorCode, String errorMsg, Throwable t) {
		super(errorCode, errorMsg, t);
	}

	/**
	 * 自定义异常Enum
	 *
	 * @param bizExpCode
	 */
	public BizException(BizExpCode bizExpCode) {
		super(bizExpCode.getErrorCode(), bizExpCode.getErrorMsg());
	}

	/**
	 * 自定义异常Enum
	 *
	 * @param bizExpCode
	 * @param t          异常堆栈
	 */
	public BizException(BizExpCode bizExpCode, Throwable t) {
		super(bizExpCode.getErrorCode(), bizExpCode.getErrorMsg(), t);
	}

	public String toString() {
		return super.toString();
	}
}
